package pack0716.com;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;

//演示properties类的使用
public class Demo1 {

    public static void main(String[] args) throws Exception {

        Properties pro=new Properties();   //根部的类

        //加载properties文件
        pro.load(new FileInputStream("a.properties"));

        //获取内容
        String k2=pro.getProperty("k2");
        System.out.println(k2);

        String s=pro.getProperty("k10","张无忌");  //意思是在a文件中找不到k10的话,则输出张无忌
        System.out.println(s);

    }
}
